package day71_814;

/**
 * @ClassName Solution
 * @Description TODO
 * @Author clockTown
 * @Date 2021/7/19 21:14
 * @Version 1.0
 */
public class Solution {


    public TreeNode pruneTree(TreeNode root) {
        if (root == null) {
            return null;
        }

        //分别对左右子树剪枝
        root.left = pruneTree(root.left);
        root.right = pruneTree(root.right);

        if (root.val == 0 && root.left == null && root.right == null){
            return null;
        }

        return root;

    }


}
